{
  "properties" : { },
  "id" : "copy1739548702299d64433",
  "script" : null,
  "groupId" : "b3703296495946aabf6a72b7d085c5d6",
  "name" : "移动文件(修正文件名)",
  "createTime" : null,
  "updateTime" : 1739550316397,
  "lock" : null,
  "createBy" : null,
  "updateBy" : "可辉",
  "path" : "upname_file",
  "method" : "GET",
  "parameters" : [ {
    "name" : "search",
    "value" : "麻豆视频免费在线观看",
    "description" : null,
    "required" : true,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": 200,\n    \"msg\": \"success\",\n    \"data\": 1\n}",
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.File;
import java.io.IOException;
import log;

var datalist = db.table('file_videos').where().like('path','%'+search+'%').select();

String regex = "-\\S+?(?=\\.mp4)";
regex = " - .+?(?=\\.mp4)";
for (item in datalist) {
    var nextUrl = item.path.replaceAll(regex, "").replaceAll(" ", "").trim();
    var nextName = item.name.replaceAll(regex, "").replaceAll(" ", "").trim();
    //return [cmd, nextUrl, nextName, item.path]
    File oldFile = new File(item.path);
    File newFile = new File(nextUrl);
    boolean isRenamed = oldFile.renameTo(newFile);
    if(isRenamed){
        // data 修正
        item.path = nextUrl;
        item.name = nextName;
        db.table('file_videos').where().eq('id', item.id).update(item)
    } else {
        log.info("文件重命名失败！");
    }

    //return [cmd, nextUrl, nextName, item.path]

    // cmd 移动
    //String cmd = "cmd /c move \""+item.path+"\"" + " \""+nextUrl+"\"";
    //Process process = Runtime.getRuntime().exec(cmd);
    //BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
    //process.waitFor();
}

return 1